<?php
include '../lib/Useradmin.php';
$userOb = new Useradmin();
$idUsers = '';
if (isset($_GET['idUsers'])) {
    $idUsers = $_GET['idUsers'];
}
$tv = $userOb->layThanhVien($idUsers);
if (empty($tv)) {
    header("Location: /admin/index.php");
}

$message = array();
if (isset($_POST['capnhat'])) {
    if ($userOb->capnhapThanhVien($idUsers, $_POST)) {
        $message[] = "Cập nhật thành công";
    } else {
        $message[] = "Cập nhật thất bại";
    }
}
?>
<!-- /TinyMCE -->
<body>
    <div class="box round first fullpage">
        <h2>Thông tin tài khoản</h2>
        <div class="block ">
            <form method="post" action="">
                <table class="form">
                    <?php if (count($message) > 0): ?>
                        <tr>
                            <td colspan="2">
                                <div class="message success">
                                    <?php foreach ($message as $mes): ?>
                                        <p><?php echo $mes ?></p>
                                    <?php endforeach; ?>
                                </div>
                            </td>         
                        </tr>
                    <?php endif; ?>
                    <tr>
                        <td class="col1">
                            <label>
                                Tên tài khoản</label>
                        </td>
                        <td class="col2" id="UserName" name="UserName">
                            <strong><?php echo $tv['UserName'] ?></strong>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label>Mật khẩu</label>
                        </td>
                        <td>
                            <input type="text" name="Pass" class="col2" id="Pass" value="<?php echo $tv['Pass'] ?>" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label>Họ: </label>
                        </td>
                        <td>
                            <input type="text" name="FirstName" id="FirstName" class="col2" value ="<?php echo $tv['FirstName'] ?>"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label>Tên:</label>
                        </td>
                        <td>
                            <input type="text" name="LastName" id="LastName" class="col2" value="<?php echo $tv['LastName'] ?>"/>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <label>Email:</label>
                        </td>
                        <td>
                            <input type="text" name="Email" id="Email" class="col2" value="<?php echo $tv['Email'] ?>"/>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <label>Ngày sinh:</label>
                        </td>
                        <td>
                            <input type="text" name="Birthday" id="Birthday" class="col2" value="<?php echo $tv['Birthday'] ?>"/>
                        </td>
                    </tr>


                    <tr>
                        <td>
                            <label>Địa chỉ:</label>
                        </td>
                        <td>
                            <input type="text" name="DiaChi" id="DiaChi" class="col2" value="<?php echo $tv['DiaChi'] ?>" size="40px"/>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <label>Nơi ở:</label>
                        </td>
                        <td>
                            <input type="text" name="Location" id="Location" class="col2" value="<?php echo $tv['Location'] ?>" size="40px"/>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <label>Điện thoại:</label>
                        </td>
                        <td>
                            <input type="text" name="PhoneNum" id="PhoneNum" class="col2" value="<?php echo $tv['PhoneNum'] ?>" size="40px"/>
                        </td>
                    </tr>
                    <tr>
                        <td><label>Loại User:</label></td>
                        <td><select name="Loai_User" id="Loai_User"/>
                    <option>2</option>
                    <option>1</option>
                    </select></td>
                    </tr>

                    <tr>
                        <td align="right"><input class="btn" type="submit" name="capnhat" id="capnhat" value="Cập nhật"</td>
                    </tr>

                </table>
            </form>
        </div>
    </div>
</div>

<div id="site_info">
    <p align="center"><b>ADMIN quản lý tài khoản</b></p>
</div>
</body>
</html>
